<div class="bt-form">
	<div class="bt-w-main">
		<div class="bt-w-menu">
			<p class="bgw" onclick="pluginService('clean');">服务</p>
			<p onclick="pluginConfig('clean');">配置修改</p>
			<p onclick="commonFunc();">常用功能</p>
			<p onclick="pluginLogs('clean',null,'run_log');">运行日志</p>
			<p onclick="pRead()">说明</p>
		</div>
		<div class="bt-w-con pd15">
			<div class="soft-man-con"></div>
		</div>
	</div>
</div>
<script type="text/javascript">

pluginService('clean');

function cleanPost(method, version, args, callback){
    var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });

    var req_data = {};
    req_data['name'] = 'clean';
    req_data['func'] = method;
    req_data['version'] = version;
 
    if (typeof(args) == 'string'){
        req_data['args'] = JSON.stringify(toArrayObject(args));
    } else {
        req_data['args'] = JSON.stringify(args);
    }

    $.post('/plugins/run', req_data, function(data) {
        layer.close(loadT);
        if (!data.status){
            layer.msg(data.msg,{icon:0,time:2000,shade: [10, '#000']});
            return;
        }

        if(typeof(callback) == 'function'){
            callback(data);
        }
    },'json'); 
}

function cleanRun(){
	cleanPost('clean_run', '', {}, function(rdata){
		// var rdata = $.parseJSON(rdata.data);
        // layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
	});

	layer.msg("执行成功!", { icon: 1});
}

function commonFunc(){

    con = '<hr/><p class="conf_p" style="text-align:center;">\
        	<button class="btn btn-default btn-sm" onclick="cleanRun()">手动执行</button>  \
    	</p>';

    $(".soft-man-con").html(con);
}

function pRead(){
	var readme = '<ul class="help-info-text c7">';
    readme += '<li>启动后,加入到计划任务每隔7天[0:15]执行。</li>';
    readme += '<li>【*】代表要删除。</li>';
    readme += '<li>添加/删除清除日志，可在`配置修改`中添加/删除。</li>';
    readme += '<li>如果是目录,会寻找【.log】后缀的文件清空。</li>';
    readme += '</ul>';

    $('.soft-man-con').html(readme);   
}
</script>